<template>
    <div class="container">
        <van-form>
            <div class="qiye-info">
                <div class="title">项目信息</div>
                <van-cell-group inset>
                  <van-field
                    v-model="form.proLevelLabel"
                    is-link
                    label="项目级别："
                    placeholder=""
                    readonly
                  />
                  <van-field
                    v-model="form.projectName"
                    name="projectName"
                    label="项目名称："
                    readonly
                    placeholder=""
                    />
                    <van-field
                    v-model="form.projectCode"
                    name="projectCode"
                    label="项目编号："
                    readonly
                    placeholder=""
                    />
                    <van-field
                    v-model="form.approvalTime"
                    is-link
                    label="立项时间："
                    readonly
                    placeholder=""
                  />
                  <van-field
                    v-model="form.projectDuration"
                    is-link
                    label="项目规定时长"
                    readonly
                    placeholder=""
                  >
                  <template #button>
                      <div size="small" type="primary">月</div>
                    </template>
                  </van-field>

                  <van-field
                    v-model="form.completeMarkLabel"
                    is-link
                    label="是否结项："
                    placeholder=""
                    readonly
                  />

                    <van-field
                    v-model="form.companyName"
                    name="companyName"
                    label="所属单位："
                    placeholder=""
                    readonly
                    />
                    <van-field
                    v-model="form.personName"
                    is-link
                    readonly
                    label="负责人："
                    placeholder=""
                  />
                    <van-field
                    v-model="form.phone"
                    name="phone"
                    label="联系方式："
                    placeholder=""
                    readonly
                    />
                    
                    <van-field
                    v-model="form.projectAmount"
                    name="projectAmount"
                    label="总额："
                    placeholder=""
                    readonly
                    >
                    <template #button>
                      <div size="small" type="primary">万元</div>
                    </template>
                  </van-field>
                    <van-field
                    v-model="form.investmentDirectionLabel"
                    name="investmentDirectionLabel"
                    label="投资方向："
                    placeholder=""
                    readonly
                    />
                    <van-field
                    v-model="form.approvalDepartmentLabel"
                    name="approvalDepartmentLabel"
                    label="立项部门："
                    placeholder=""
                    readonly
                    />
                  
                  <van-field
                    v-model="form.subsidizeProjectLabel"
                    is-link
                    label="资助项目名称："
                    readonly
                    placeholder=""
                  />
                  <van-field
                    v-model="form.subsidizeAmount"
                    is-link
                    label="项目资助金额："
                    readonly
                    placeholder=""
                  >
                  <template #button>
                      <div size="small" type="primary">万元</div>
                    </template>
                  </van-field>
                  <!-- <van-field
                    v-model="form.subsidizePhaseLabel"
                    is-link
                    label="项目资助阶段："
                    readonly
                    placeholder=""
                  />
                  <van-field
                    v-model="form.subsidizeTime"
                    is-link
                    label="项目资助时间："
                    readonly
                    placeholder=""
                  /> -->
                  
                  <van-field
                    v-model="form.intro"
                    name="intro"
                    label="项目简介："
                    placeholder=""
                    readonly
                    />
                </van-cell-group>
            </div>
        </van-form>

    </div>
</template>
 
<script setup>
import { ref } from 'vue';
import { reactive } from 'vue';
import { useRouter,useRoute } from 'vue-router';
import { onMounted } from 'vue'
import { showToast } from 'vant';
import { getProjectDetail,getTalentList,editProject,creatProject } from '@/api/company';
import { localStorage } from '@/utils/local-storage';
const router = useRouter()
const route = useRoute();
const form = reactive({
  companyName: "",
  projectName: '',
  projectCode: '',
  phone: '',
  projectAmount: '',
  projectCode: '',
  projectId: '',
  companyId: '',
  investmentDirectionLabel: '',
  approvalDepartmentLabel: '',
  approvalTime: '',
  intro: '',
  completeMarkLabel: '',
  proLevelLabel: ''
})


async function getDetail() {
  const id = route.query.projectId || '';
  const { code, data } = await getProjectDetail(id);
  if(code === 200) {
    if(data.talent_company_info){
      form.companyName = data.talent_company_info.companyName
    }
    if(data.talent_person_info){
      form.personName = data.talent_person_info.name
    }
    form.projectName = data.projectName
    form.projectAmount = data.projectAmount
    form.phone = data.phone
    form.projectCode = data.projectCode
    form.investmentDirectionLabel = data.investmentDirectionLabel
    form.approvalDepartmentLabel = data.approvalDepartmentLabel
    form.completeMarkLabel = data.completeMarkLabel
    form.proLevelLabel = data.proLevelLabel
    form.approvalTime = data.approvalTime
    form.subsidizeAmount = data.subsidizeAmount
    form.subsidizeProjectLabel = data.subsidizeProjectLabel
    form.subsidizePhaseLabel = data.subsidizePhaseLabel
    form.subsidizeTime = data.subsidizeTime
    form.projectDuration = data.projectDuration
    form.intro = data.intro
  }
}

onMounted(() => {
  setTimeout(()=>{
      getDetail()
    },1000)
})
</script>
 

<style lang="scss" scoped>
.container {
  background: #f9f9f9;
  overflow: hidden;
  padding: 0.9rem 1.3rem 1.7rem;
}
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: #fff;
}
.addbtn{
  position: fixed;
  bottom: 2rem;
  width: 92%;
  left: 4%;
}
.van-button{
  font-size: 1.8rem;
  font-weight: 400;
}
.van-form{
  padding: 0 0 0 0;
}
.van-cell-group{
  background: #fff;
}
.van-field{
 border-bottom: 1px solid #E0E0E4;
 padding: 2rem 0 1.6rem;
}
.title{
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.5rem 1.2rem;
}
.qiye-info{
    background: #fff;
    padding: 1.2rem 0 1.5rem 0;
}
.qita{
    margin-top: 2rem;
    padding: 1.2rem;
    background: #fff;
    margin-bottom: 2.6rem;
}
.title2{
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}
.title3{
    font-size: 1.4rem;
    font-weight: 400;
    margin: 0 0 0.9rem 0;
}

::v-deep .van-field__label{
  width: 10rem!important;
}

::v-deep .van-cell__right-icon{
  display: none;
}

</style>